package o;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.content.DialogInterface.OnKeyListener;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
import o.dky.h;
import o.dky.i;
import o.dky.j;

public class VideoNetChangeDialog {
    private static boolean ˏ = false;
    private static boolean ॱ = false;
    private TextView ʻ;
    private CheckBox ʼ;
    private d ʽ;
    private cku ˊ;
    private String ˋ = "VideoNetChangeDialog";
    private View ˎ;
    private Context ॱॱ;

    public interface d {
        void ˊ();

        void ॱ();
    }

    static class e implements OnDismissListener {
        private e() {
        }

        public void onDismiss(DialogInterface dialogInterface) {
            VideoNetChangeDialog.ॱ(false);
        }
    }

    public VideoNetChangeDialog(final Context context) {
        this.ॱॱ = context;
        this.ˊ = cku.ˏ(context, cku.class, null, null);
        this.ˎ = LayoutInflater.from(context).inflate(i.ʾ, null);
        this.ʻ = (TextView) this.ˎ.findViewById(h.ॱㆍ);
        this.ʼ = (CheckBox) this.ˎ.findViewById(h.ͺ);
        if (doo.ᐝ(context)) {
            this.ʻ.setText(NetWorkUtil.getWifiResId(context, j.ˎˎ));
        } else {
            this.ʻ.setText(NetWorkUtil.getWifiResId(context, j.ˌ));
        }
        this.ʼ.setText(NetWorkUtil.getWifiResId(context, j.ˋᐝ));
        int ˎ = ewb.ˎ((Activity) this.ˎ.getContext());
        this.ˎ.setPadding(ˎ, ˎ, ˎ, 0);
        this.ˊ.ˊ(this.ˎ);
        this.ˊ.ॱ(-2, context.getString(j.ͺ));
        this.ˊ.ॱ(-1, context.getString(j.ˊˋ));
        this.ˊ.ˏ(new OnKeyListener(this) {
            final /* synthetic */ VideoNetChangeDialog ॱ;

            public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
                if (i != 4) {
                    return false;
                }
                cku.ˎ(context, "videonetdialog");
                if (this.ॱ.ʽ != null) {
                    this.ॱ.ʽ.ॱ();
                }
                return true;
            }
        });
        this.ˊ.ॱ(new cks(this) {
            final /* synthetic */ VideoNetChangeDialog ॱ;

            {
                this.ॱ = r1;
            }

            public void enableNetworking() {
                if (this.ॱ.ʼ.isChecked()) {
                    evr.ˊ().ˋ(0);
                }
                VideoNetChangeDialog.ॱ = true;
                if (this.ॱ.ʽ != null) {
                    this.ॱ.ʽ.ˊ();
                }
                VideoNetChangeDialog.ॱ(false);
            }

            public void upgrade() {
                if (this.ॱ.ʽ != null) {
                    this.ॱ.ʽ.ॱ();
                }
                VideoNetChangeDialog.ॱ(false);
            }

            public void ˋ() {
            }
        });
        this.ˊ.ˎ(new e());
    }

    public static boolean ˊ() {
        return (evr.ˊ().ˋ() == 0 || ॱ) ? false : true;
    }

    public static void ˏ(boolean z) {
        ॱ = z;
    }

    public static boolean ˏ() {
        return ˏ;
    }

    private static void ॱ(boolean z) {
        ˏ = z;
    }

    public static boolean ˎ(Context context) {
        return doo.ॱॱ(context) && !doo.ᐝ(context);
    }

    public static boolean ˏ(Context context) {
        return doo.ͺ(context);
    }

    public static void ˎ() {
        ॱ = false;
    }

    public void ˋ(d dVar) {
        this.ʽ = dVar;
    }

    public void ˋ() {
        if (!ˏ && this.ˊ != null) {
            this.ˊ.ˋ(this.ॱॱ, "videonetdialog");
            ॱ(true);
        }
    }
}
